<template>
    <div id="myclass">
        <div class="titlebox">
            <div class="titleitem" v-for="(item, index) in titleList" :key="index">
               <span> {{ item.name }}</span>  <span v-if="kelist">( {{ kelist ? kelist : "0"}} )</span>
            </div>
        </div>

        <div class="classbox">
            <div class="classitem" v-for="(item, index) in classInfo" :key="index">
                <div class="left">
                    <div class="icon">
                        <div class="el-icon-video-play"></div>
                    </div>
                    <div class="title">
                        {{ item.name }}
                    </div>
                </div>
                <div class="right">
                    <el-link type="danger" size="mini" :href="item.computer" target="_blank" >进入观看</el-link>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                classList: [],
                classname: "",
                classInfo: [],
                titleList: [
                    { name: "网络课程", type: "1" },
                    { name: "直播课列表", type: "2" },
                    { name: "听课记录", type: "3" },
                    { name: "面授课程", type: "4" },
                    { name: "过期课程", type: "5" },
                ],
                kelist: ""
            }
        },
        computed: {
            token() {
                return localStorage.token;
            }
        },
        mounted () {
            this.getClass();
        },
        methods: {
            async  getClass() {
                let res = await this.$axios.post("/port/user/myexamin", { token: this.token })
                this.classInfo = res.data.data.examin
            }
        },
    }
</script>

<style lang="scss" scoped>
#myclass {
    width: 800px;
    box-sizing: border-box;
    .titlebox {
        width: 100%;
        display: flex;
        align-items: center;
        .titleitem {
            flex: 1;
            text-align: center;
            border-right: 1px solid #f2f2f2;
            border-bottom: 1px solid #aaa;
            height: 40px;
            line-height: 40px;
            cursor: pointer;
        }
    }
    .classbox {
        width: 100%;
        padding: 20px;
        box-sizing: border-box;
        .classitem {
            width: 100%;
            height: 30px;
            line-height: 30px;
            display: flex;
            align-items: center;
            cursor: pointer;
            justify-content: space-between;
            &:hover {
                color: red;
                // border-bottom: 1px solid red;
            }
            .left {
                flex: 1;
                overflow: hidden;
                display: flex;
                align-items: center;
                .icon {
                    margin-right: 10px;
                }
            }
        }
        
    }
}
</style>